#include "StdAfx.h"
#include "GroundUnitDisObj.h"


CGroundUnitDisObj::CGroundUnitDisObj(CGroundUnit* pGroundUnit)
	: CDisplayObj((CEntityObj *)pGroundUnit)
{
}

CGroundUnitDisObj::CGroundUnitDisObj( const CGroundUnitDisObj* pDisObj, CGroundUnit *PGroundUnit/*=NULL*/ )
	:CDisplayObj(pDisObj,(CEntityObj*)PGroundUnit)
{

}


CGroundUnitDisObj::~CGroundUnitDisObj(void)
{
}

bool CGroundUnitDisObj::IsGroundDisObj() const
{
	return true;
}

void CGroundUnitDisObj::Serialize( CArchive & ar )
{
	CDisplayObj::Serialize(ar);
}

void CGroundUnitDisObj::Display( CHoopsMap *pHoopsMap )
{
	
}

void CGroundUnitDisObj::Transform( const CMatrix transf )
{

}

eDisplayObjType CGroundUnitDisObj::GetDisplayObjType() const
{
	return GROUND_UNIT_DIS_OBJ;
}

CObj * CGroundUnitDisObj::Clone() const
{
	return new CGroundUnitDisObj(this);
}

bool CGroundUnitDisObj::GetBox( double & dblLeft, double & dblBottom, double & dblRight, double & dblTop ) const
{
	return false;
}

eGroundUnitDisType CGroundUnitDisObj::GetGroundUnitDisType() const
{
	return GROUND_UNKNOW_DISOBJ;
}

double CGroundUnitDisObj::GetHeight()
{
	double dWidth2HeightRatio = GetWidth2HeightRatio();
	double dHeight = m_dblWidth/dWidth2HeightRatio;

	return dHeight;
}

double CGroundUnitDisObj::GetWidth() const
{
	return m_dblWidth;
}

void CGroundUnitDisObj::SetWidth( double width )
{
	m_dblWidth = width;
}

void CGroundUnitDisObj::SetHeight( double dHeight )
{
	double dWidth2HeightRatio = GetWidth2HeightRatio();
	m_dblWidth = dHeight*dWidth2HeightRatio;
}

void CGroundUnitDisObj::SetRotaAngle( double dAngle )
{
	m_dRotateAngle = dAngle;
}

double CGroundUnitDisObj::GetRoteAngle() const
{
	return m_dRotateAngle;
}

double CGroundUnitDisObj::GetWidth2HeightRatio()
{
	double dWidth2HeightRatio(1.5);

	return dWidth2HeightRatio;
}

double CGroundUnitDisObj::GetOriginWidth()
{
	double dOriginWidth(70);
	return dOriginWidth;
}

double CGroundUnitDisObj::GetScale()
{
	double dOriginWidth = GetOriginWidth();
	double dScale = m_dblWidth/dOriginWidth;

	return dScale;
}
